<?php

/**
 * Class for rendering a button element.
 *
 * @author Ian Clarence <ian.clarence@gmail.com>
 */
class ViewButton extends ViewHtmlFormElement {

    /**
     * Flag indicating whether there is any whitespace in the inner HTML.
     */
    const NO_WHITESPACE = TRUE;

    /**
     * The constructor.
     *
     * @param array $fields
     */
    public function __construct(array $fields = array()) {

        $fields["tag"] = "button";
        $fields["type"] = "submit";
        $fields["name"] = isset($fields["name"]) ? $fields["name"] : "submit";
        $fields['element_id'] = $fields['name'];
        $fields["message"] = isset($fields["message"]) ? $fields["message"] : "Submit";

        parent::__construct($fields);

        $this->setAttribute("type", $this->getType());
        $this->addText($this->getMessage());
    }

}